// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
const tencentcloud = require("tencentcloud-sdk-nodejs");
module.exports = {
    send(tel, code){
        const SmsClient = tencentcloud.sms.v20210111.Client;

        const clientConfig = {
        credential: {
            secretId: "AKID5oLbaPUAzKWYSCrZJyYvW0GOsChLi8LZ",
            secretKey: "KgeNq2MPziBdopgV9PVRQtBd2iRya6MT",
        },
        region: "ap-nanjing",
        profile: {
            httpProfile: {
            endpoint: "sms.tencentcloudapi.com",
            },
        },
        };

        const client = new SmsClient(clientConfig);
        const params = {
            "PhoneNumberSet": [
                "+86" + tel
            ],
            "SmsSdkAppId": "1400489828",
            "SignName": "爱code爱生活",
            "TemplateId": "881527",
            "TemplateParamSet": [
                "" + code
            ]
        };
        return client.SendSms(params);
    }
}